hysop.backend.device.opencl.operator.external_force module¶
- class hysop.backend.device.opencl.operator.external_force.OpenClSpectralExternalForce(Fext, **kwds)[source]¶
Bases:
SpectralExternalForceOperatorBase
,OpenClSymbolic
Operator to compute the curl of a symbolic expression.
Create an operator that computes the curl of a given input force field Fext.
- Only the following configurations are supported:
dim nb_components | dim nb_components
vorticity: 2 1 | 3 3
- What is computed:
force = curl(Fext) by using a spectral backend Fmin = min(force) Fmax = max(force) Finf = max(abs(Fmin), abs(Fmax)) W += dt*force
where Fext is computed from user given ExternalForce.
- Parameters:
vorticity (hysop.field.continuous_field.Field) – Continuous field as input ScalarField or VectorField. All contained field have to live on the same domain.
Fext (hysop.operator.external_force.ExternalForce) – Expression of the external force.
F... (TensorParameter or boolean, optional) – TensorParameters should match the shape of tmp (see Notes). If set to True, the TensorParameter will be generated automatically.
variables (dict) – dictionary of fields as keys and topologies as values.
kwds (dict, optional) – Extra parameters passed towards base class (MultiSpaceDerivatives).
Notes
- If dim == 2, it is expected that:
vorticity has only one component Fext has 2 components
- Else if dim == 3:
vorticity has 3 components Fext has 3 components
- class hysop.backend.device.opencl.operator.external_force.SymbolicExternalForce(name, Fext, diffusion=None, **kwds)[source]¶
Bases:
ExternalForce
Specify an external force as a tuple of symbolic expressions.
- 2D ExternalForce example:
- Fext = -rho*g*e_y where rho is a field and g a constant
Fext = (0, -rho.s()*g)
- Fext = (Rs*S+C)*e_y
Fext = (0, -Rs*S.s()+C.s())
- apply(**kwds)¶